GetNewDialog
CHANGED WITH THE APPEARANCE MANAGER
Creates a dialog box from a resource-based description.
pascal DialogPtr GetNewDialog ( short dialogID, void *dStorage, WindowPtr behind);
dialogID
- The resource ID of a dialog resource and an extended dialog resource. The resource IDs for both resources must be identical. If the dialog resource is missing, the Dialog Manager returns to your application without creating the requested dialog box.
dStorage
- A pointer to the memory for the dialog structure. If you set this parameter to
nil
, the Dialog Manager automatically allocates a nonrelocatable block in your application heap.behind
- A pointer to the window behind which the dialog box is to be placed on the desktop. Set this parameter to the window pointer
(WindowPtr)-1L
to bring the dialog box in front of all other windows.- function result
- Returns a pointer to a dialog box. If none was created, returns
nil
.DISCUSSION
TheGetNewDialog
function creates a dialog structure from information in a dialog resource and an extended dialog resource (if it exists) and returns a pointer to the dialog structure. You can use this pointer with Window Manager or QuickDraw functions to manipulate the dialog box. If the dialog resource specifies that the dialog box should be visible, the dialog box is displayed. If the dialog resource specifies that the dialog box should initially be invisible, use the Window Manager functionShowWindow
to display the dialog box.The dialog resource contains the resource ID of the dialog box's item list (
'DITL')
resource and its dialog font table ('dftb'
) resource. After calling the Resource Manager to read these resources into memory (if they are not already in memory),GetNewDialog
makes a copy of the'DITL'
resource and uses that copy; thus you may have several dialog boxes with identical items.If you supply a dialog color table (
'dctb'
) resource with the same resource ID as the dialog resource,GetNewDialog
usesNewColorDialog
and returns a pointer to a color graphics port. If no dialog color table resource is present,GetNewDialog
usesNewDialog
to return a pointer to a black-and-white graphics port, although system software draws the window frame using the system's default colors. However, if the Appearance Manager is available and thekDialogFlagsUseThemeBackground
feature bit of the extended dialog resource is set, then the'dctb'
resource is ignored and a color graphics port is created.SPECIAL CONSIDERATIONS
TheGetNewDialog
function doesn't release the memory occupied by the resources. Therefore, your application should mark all resources used for a dialog box as purgeable or you should release the resources yourself.If either the dialog resource or the item list resource can't be read, the function result is
nil
; your application should test to ensure thatnil
is not returned before performing any more operations with the dialog box or its items.As with all other windows, dialogs are created with an update region equal to their port rectangle. However, if the dialog's
'DLOG'
resource specifies that the dialog be made visible upon creation, the Dialog Manager draws the controls immediately and callsValidRgn
for each of their bounding rectangles. Other items are not drawn until the first update event for the dialog box is serviced.If you need to display an alert box while your application is running in the background or is otherwise invisible to the user, call
AEInteractWithUser
; see Inside Macintosh: Interapplication Communication.WHEN THE APPEARANCE MANAGER IS NOT AVAILABLE
GetNewDialog
does not read in the resource IDs of extended dialog resources or dialog font table resources.